<%@ page language="java" contentType="text/html; charset=UTF-8"%>
<%@include file="/include/common/gridbackhead.jsp"%>
<%!
private class PageAction extends BaseAction{
	ResultSet rs = null;
	
	//准备action的环境变量 每次请次都会执行此方法 可在此方法中初如化一些变量
	protected void prepareActionEnv() throws Exception{
		
	}
	
	//加載頁面默認數據
	protected boolean onLoadDefault() throws Exception{
		if(!form.isNullOrEmpty("pan_subpro_menusn")){
			rs = utils.executeQuery("info5","select * from pan..pan_subpro_menu where sn = '"+form.gpsv("pan_subpro_menusn")+"'");
			if(rs.next()){
				form.FromResultSet(rs, false);
				if("0".equalsIgnoreCase(form.gpsv("enab"))){
					ret.setWarningInfo("此單已取消!");
					page.getToolbar().disableAllButtonExcept("newnext");
				}
			}else{
				ret.setWarningInfo("此單已刪除,如需要請重新新增!");
				page.getToolbar().disableAllButtonExcept("newnext");
			}
			onSearchRetrieveResult();
		}
		return true ;
	}
	
	protected void doSave() throws Exception{
		if(!form.isNullOrEmpty("pan_subpro_menusn")){
			//1.儲存
			CrudDataEntity crud = form.getCrudDataEntity("info5","pan..pan_subpro_menu","sn");
			crud.spsv("sn", form.gpsv("pan_subpro_menusn"));
			crud.setSpportSimple(true);
			crud.spsv("public", form.gpsv("public","0"));
			crud.appendUpdateCols();
			crud.save();
			ret.setOkInfo("存儲ok!");
		}
	}

}
%>
<%@include file="/include/common/gridbackend.jsp"%>